
#include "main.h" 

//unsigned int near val = 0;
//unsigned char near count = 0;
//unsigned int near count2 = RING_LONG;   

void interrupt ISR(void)
{
	
   if ( TMR3IE && TMR3IF )
	{
		if ( RF_TX_START )
			RF_Transmitter();
		else
			RF_Receiver();
	}

	if ( INT0IE && INT0IF )
	{	
		PIN_MODEM_POWER = 0;
		putsf("\r\n=== INTERRUPT ===\r\n", AUX_PORT); //Dima
		SysState = SAVE_MODE;
		PIN_MODEM_POWER = 0;
		//EEPROM_WRITE(E2_ADDR_SMS_USER_NEW_MESSAGE_COUNT, SMS_User_New_Message_Count);
		INT0IF = 0;
		return ;
	}


   if ( CCP1IE && CCP1IF )
   {
      CCP1IF = 0;
      TMR1 = 0;
   }

   if ( TMR2IE && TMR2IF )
   {
      TMR2IF = 0;
      //CLRWDT();
   }

	/* USART */
   if ( RC1IE && RC1IF )
   {
		if ( RECEIVER == MODEM_RX_1 )
			Modem_RX_1();
		else
			Modem_RX_2();			  /* for DATA MODE */
	}
   
   if ( RC2IE && RC2IF )
   {
		//RCREG2 = RCREG2;
//		PIN_LED ^= 1;
		Aux_Port_RX();
   }  
	
}

